<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<title><?php echo C('WEB_TITLE');?></title>

		<link rel="stylesheet" type="text/css" href="/Public/css/common.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/js/layui/css/layui.css" media="all"/>

		<link rel="stylesheet" href="/Public/js/datepicker/datepicker.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/crm/css/index.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/crm/css/style.css"/>

		<link rel="stylesheet" href="<?php echo C('PC_ICON_HTTP');?>">

		<script type="text/javascript" >

			const moduleName = "<?php echo (MODULE_NAME); ?>";

		</script>

        <link rel="stylesheet" href="/Public/js/viewer/css/viewer.min.css">
		
		<link rel="stylesheet" type="text/css" href="/Public/js/select2/select2.css" media="all"/>

		<script type="text/javascript" src="/Public/js/jquery-1.9.1.min.js"></script>
		
		<script type="text/javascript" src="/Public/js/jquery-ui.min.js"></script>

		<script type="text/javascript" src="/Public/js/cookie/jquery.cookie.js"></script>

		<script type="text/javascript" src="/Public/js/lang/<?php echo (getStrToLower(cookie('think_language'))); ?>.js"></script>

		<script type="text/javascript" src="/Public/js/colorpicker.js"></script>

		<script type="text/javascript" src="/Public/js/layer/layer.js"></script>

		<script type="text/javascript" src="/Public/js/layui/layui.js"></script>

        <script type="text/javascript" src="/Public/js/feeldesk.js"></script>

        <script type="text/javascript" src="/Public/crm/js/index.js"></script>

        <script type="text/javascript" src="/Public/js/jquery.nicescroll.js"></script>

		<script type="text/javascript" src="/Public/js/clipboard.min.js"></script>

		<script type="text/javascript" src="/Public/js/select2/select2.min.js"></script>

		<script type="text/javascript" src="/Public/js/select2/jquery.core.js"></script>

	</head>

<body>

<script type="text/javascript" src="/Public/js/datepicker/datepicker.all.js"></script>

<script type="text/javascript" src="/Public/js/datepicker/moment.min.js"></script>

<script type="text/javascript" src="/Public/js/datepicker/datepicker.en.js"></script>

    <div class="fd-right-main">

        

    <div class="feeldesk-form pd0">

        <div class="form-nav">

            <ul>

                <li><a href="javascript:" class="form-tab active"><?php echo L('NEW_FORM');?></a></li>

                <li><a href="javascript:" class="intro-tab"><?php echo L('SET_INSTRUCT');?></a></li>

            </ul>

        </div>

        <div class="form-content pt100">

            <form action="<?php echo U('DefineForm/edit',['id'=>encrypt($detail['form_id'],'DEFINEFORM'),'type'=>encrypt($type,'DEFINEFORM')]);?>" class="layui-form" method="post">

                <div class="form-item">

                    <input type="hidden" name="define_form[form_id]" value="<?php echo (encrypt($detail["form_id"],'DEFINEFORM')); ?>"/>

                    <input type="hidden" name="define_form[type]" value="<?php echo (encrypt($type,'DEFINEFORM')); ?>"/>

                    <div class="layui-form-item">

                        <label class="layui-form-label"><?php echo L('FORM_TYPE');?></label>

                        <div class="layui-input-inline">

                            <select name="define_form[form_type]" disabled>

                                <option value="text" <?php if(($detail["form_type"]) == "text"): ?>selected<?php endif; ?>><?php echo L('TEXT');?></option>

                                <option value="textarea" <?php if(($detail["form_type"]) == "textarea"): ?>selected<?php endif; ?>><?php echo L('TEXTAREA');?></option>

                                <option value="radio" <?php if(($detail["form_type"]) == "radio"): ?>selected<?php endif; ?>><?php echo L('RADIO');?></option>

                                <option value="checkbox" <?php if(($detail["form_type"]) == "checkbox"): ?>selected<?php endif; ?>><?php echo L('CHECKBOX');?></option>

                                <option value="select" <?php if(($detail["form_type"]) == "select"): ?>selected<?php endif; ?>><?php echo L('SELECT');?></option>

                                <option value="select_text" <?php if(($detail["form_type"]) == "select_text"): ?>selected<?php endif; ?>><?php echo L('SELECT_TEXT');?></option>

								<option value="date" <?php if(($detail["form_type"]) == "date"): ?>selected<?php endif; ?>><?php echo L('DATETIME');?></option>

                                <option value="region" <?php if(($detail["form_type"]) == "region"): ?>selected<?php endif; ?>><?php echo L('AREA_COMPONENTS');?></option>

                                <option value="phone" <?php if(($detail["form_type"]) == "phone"): ?>selected<?php endif; ?>><?php echo L('CELL_PHONE');?></option>

                                <option value="email" <?php if(($detail["form_type"]) == "email"): ?>selected<?php endif; ?>><?php echo L('MAILBOX');?></option>

                                <option value="number" <?php if(($detail["form_type"]) == "number"): ?>selected<?php endif; ?>><?php echo L('DIGITAL');?></option>


                            </select>

                        </div>

                    </div>

                    <?php if(in_array(($detail["form_type"]), explode(',',"radio,checkbox,select,select_text"))): ?><div class="layui-form-item">

                            <label class="layui-form-label"><span class="red">*</span> <?php echo l('FORM_OPTION');?></label>

                            <div class="layui-input-inline">

                                <input type="text" name="define_form[form_option]" value="<?php echo ($detail["form_option"]); ?>" placeholder=<?php echo L('ENTER_OPTION');?>" class="layui-input">

                            </div>

                        </div><?php endif; ?>

                    <div class="layui-form-item">

                        <label class="layui-form-label"><span class="red">*</span> <?php echo l('FIELD_NAME');?></label>

                        <div class="layui-input-inline">

                            <input type="text" name="define_form[form_name]" value="<?php echo ($detail["form_name"]); ?>" class="layui-input layui-disabled" readonly  placeholder="<?php echo L('ENTER_FIELD_NAME');?>"  />

                        </div>

                    </div>

                    <div class="layui-form-item">

                        <label class="layui-form-label"><span class="red">*</span> <?php echo l('FORM_NAME');?></label>

                        <div class="layui-input-inline">

                            <input type="text" name="define_form[form_description]" value="<?php echo ($detail["form_description"]); ?>" class="layui-input" placeholder="<?php echo L('ENTER_FORM_NAME');?>" />

                        </div>

                    </div>

                    <?php if(($langAuth['en_auth']) == "10"): ?><div class="layui-form-item">

                            <label class="layui-form-label">English name</label>

                            <div class="layui-input-inline">

                                <input type="text" name="define_form[name_en]" value="<?php echo ($detail["name_en"]); ?>"  placeholder="Enter English name" class="layui-input">

                            </div>

                        </div><?php endif; ?>

                    <?php if(($langAuth['jp_auth']) == "10"): ?><div class="layui-form-item">

                            <label class="layui-form-label">日本語名</label>

                            <div class="layui-input-inline">

                                <input type="text" name="define_form[name_jp]" value="<?php echo ($detail["name_jp"]); ?>"  placeholder="日本語名を入力してください" class="layui-input">

                            </div>

                        </div><?php endif; ?>

                    <div class="layui-form-item">

                        <label class="layui-form-label"><?php echo l('FORM_DESCRIPTION');?></label>

                        <div class="layui-input-inline">

                            <input type="text" name="define_form[form_explain]" value="<?php echo ($detail["form_explain"]); ?>" class="layui-input" placeholder="<?php echo l('ENTER_FORM_DESCRIPTION');?>" />

                        </div>

                    </div>

                    <div class="layui-form-item">

                        <label class="layui-form-label"><?php echo l('IS_NOT_REQUIRED');?></label>

                        <div class="layui-input-inline">

                            <select name="define_form[is_required]">

                                <option value="0" <?php if(($detail["is_required"]) == "0"): ?>selected="selected"<?php endif; ?>><?php echo l('YES');?></option>

                                <option value="1" <?php if(($detail["is_required"]) == "1"): ?>selected="selected"<?php endif; ?>><?php echo l('NO');?></option>

                            </select>

                        </div>

                    </div>

					<div class="layui-form-item">

                        <label class="layui-form-label"><?php echo L('WHETHER_TO_PREVENT_WEIGHT');?></label>

                        <div class="layui-input-inline">

                            <select name="define_form[is_unique]">

                                <option value="1" <?php if(($detail["is_unique"]) == "1"): ?>selected="selected"<?php endif; ?>><?php echo L('YES');?></option>

                                <option value="0" <?php if(($detail["is_unique"]) == "0"): ?>selected="selected"<?php endif; ?>><?php echo L('NO');?></option>

                            </select>

                        </div>

                    </div>

					<div class="layui-form-item">

                        <label class="layui-form-label"><?php echo L('LIST_DISPLAY');?></label>

                        <div class="layui-input-inline">

                            <select name="define_form[show_list]">

                                <option value="1" <?php if(($detail["show_list"]) == "1"): ?>selected="selected"<?php endif; ?>><?php echo L('YES');?></option>

                                <option value="0" <?php if(($detail["show_list"]) == "0"): ?>selected="selected"<?php endif; ?>><?php echo L('NO');?></option>

                            </select>

                        </div>

                    </div>

                    <div class="layui-form-item">

                        <label class="layui-form-label"><?php echo L('IS_ENABLE');?></label>

                        <div class="layui-input-inline">

                            <select name="define_form[closed]">

                                <option value="0" <?php if(($detail["closed"]) == "0"): ?>selected="selected"<?php endif; ?>><?php echo L('ENABLE');?></option>

                                <option value="1" <?php if(($detail["closed"]) == "1"): ?>selected="selected"<?php endif; ?>><?php echo L('DISABLE');?></option>

                            </select>

                        </div>

                    </div>

                    <div class="layui-form-item">

                        <label class="layui-form-label mt5"><?php echo L('VIEW_RANGE');?></label>

                        <div class="layui-input-inline" id="form_view_range"></div>

                    </div>

                    <div class="layui-form-item">

                        <label class="layui-form-label mt5"><?php echo L('MODIFY_AUTH');?></label>

                        <div class="layui-input-inline" id="form_edit_auth"></div>

                    </div>

                    <script type="text/javascript">

                        var roleList = <?php echo ($roleList); ?>;

                        var roleSelected = '<?php echo ($detail["role_id"]); ?>';

                        var memberList = <?php echo ($memberList); ?>;

                        var memberRole = '<?php echo ($memberRole); ?>';

                        if(!memberRole)
                        {
                            memberRole = memberList;
                        }
                        else
                        {
                            memberRole = JSON.parse(memberRole);
                        }

                        var memberSelected = '<?php echo ($detail["member_id"]); ?>';

                        var is_loaded = 1;

                        layui.config({
                            base : '/Public/js/layui/extends/'
                        }).use(['selectM'],function()
                        {
                            var list = layui.selectM(
                            {
                                elem: '#form_edit_auth',
                                tips: '<?php echo L("PLEASE_SELECT");?>',
                                data: memberRole,
                                selected: memberSelected.split(','),
                                width:'60%',
                                max:100,
                            });

                            layui.selectM(
                            {
                                elem: '#form_view_range',
                                data: roleList,
                                selected: roleSelected.split(','),
                                tips: '<?php echo L("PLEASE_SELECT");?>',
                                width:'60%',
                                max:100,
                                callback:function (values)
                                {
                                    var roles = values;

                                    if(roles && is_loaded != 1)
                                    {
                                        if(roles.length == 0)
                                        {
                                            list.config.data = memberList;
                                            list.render();
                                            list.render();
                                        }
                                        else
                                        {
                                            $.ajax({
                                                url:"<?php echo U('AjaxRequest/getMemberByRole');?>",
                                                type:'POST',
                                                async: false,
                                                data:{'role_id':roles},
                                                datatype:'json',
                                                success:function(data)
                                                {
                                                    if(data)
                                                    {
                                                        list.config.data = data.data;
                                                        list.render();
                                                        list.render();
                                                    }
                                                }
                                            });
                                        }
                                    }

                                    is_loaded = 0;
                                }
                            });
                        })

                    </script>

                    <div class="layui-form-item">

                        <label class="layui-form-label"><?php echo L('SORT');?></label>

                        <div class="layui-input-inline">

                            <input type="text" name="define_form[orderby]" id="ticket_form_orderby"  value="<?php echo ($detail["orderby"]); ?>" class="layui-input" placeholder="<?php echo l('ENTER_FORM_SORT');?>" />

                        </div>

                    </div>

                </div>

                <div class="form-submit">

                    <div class="layui-form-item">

                        <div class="layui-input-inline">

                            <a href="javascript:void(0)" class="layui-btn layui-btn-normal" id="submitForm"><?php echo L('SUBMIT');?></a>

                        </div>

                    </div>

                </div>

            </form>

        </div>

        <div class="form-intro hidden">

            <div class="intro-item">

                <div class="intro-title"><?php echo L('FORM_TYPE_STYLE');?> <i class="iconfont icon-xiangxiajiantou fr"></i></div>

                <div class="intro-detail layui-form hidden">

                    <div class="intro-form layui-input-block ml0">

                        <input type="text" class="layui-input form-input" placeholder="<?php echo L('TEXT');?>" disabled>

                        <select name="xiala" lay-filter="form_type">

                            <option value=""><?php echo L('SELECT');?></option>

                            <option value=""><?php echo L('OPTION',['format'=>'A']);?></option>

                            <option value=""><?php echo L('OPTION',['format'=>'B']);?></option>

                            <option value=""><?php echo L('OPTION',['format'=>'C']);?></option>

                        </select>

                        <textarea class="layui-textarea" disabled><?php echo L('TEXTAREA_NOTE');?></textarea>

                        <div class="layui-form-item">

                            <label class="layui-form-label pl0"><?php echo L('RADIO');?></label>

                            <div class="layui-input-block ml0">

                                <input type="radio" name="danxuan" title="<?php echo L('OPTION',['format'=>'A']);?>"/>

                                <input type="radio" name="danxuan" title="<?php echo L('OPTION',['format'=>'B']);?>"/>

                                <input type="radio" name="danxuan" title="<?php echo L('OPTION',['format'=>'C']);?>"/>

                            </div>

                        </div>

                        <div class="layui-form-item">

                            <label class="layui-form-label pl0"><?php echo L('CHECKBOX');?></label>

                            <div class="layui-input-block ml0">

                                <input type="checkbox" name="danxuan" title="<?php echo L('OPTION',['format'=>'A']);?>" lay-skin="primary" />

                                <input type="checkbox" name="danxuan" title="<?php echo L('OPTION',['format'=>'B']);?>" lay-skin="primary" />

                                <input type="checkbox" name="danxuan" title="<?php echo L('OPTION',['format'=>'C']);?>" lay-skin="primary" />

                            </div>

                        </div>

                    </div>

                </div>

            </div>

            <div class="intro-item">

                <div class="intro-title"><?php echo L('FORM_OPTION_NOTE');?> <i class="iconfont icon-xiangxiajiantou fr"></i></div>

                <div class="intro-detail hidden">

                    <p>1. <?php echo L('FORM_OPTION_NOTE5',['a'=>l('RADIO'),'b'=>l('CHECKBOX'),'c'=>l('SELECT'),'d'=>l('SELECT_TEXT')]);?></p>

                    <p>2. <?php echo L('FORM_OPTION_NOTE2');?></p>

                    <p>3. <?php echo L('FORM_OPTION_NOTE3');?></p>

                    <p>4. <?php echo L('FORM_OPTION_NOTE4');?></p>

                </div>

            </div>

            <div class="intro-item">

                <div class="intro-title"><?php echo L('FIELD_NAME_NOTE');?> <i class="iconfont icon-xiangxiajiantou fr"></i></div>

                <div class="intro-detail hidden">

                    <p>1. <?php echo L('FIELD_NAME_NOTE1');?></p>

                    <p>2. <?php echo L('FIELD_NAME_NOTE2');?></p>

                    <p>3. <?php echo L('FIELD_NAME_NOTE3');?></p>

                    <p>4. <?php echo L('FIELD_NAME_NOTE4');?></p>

                    <p>5. <?php echo L('FIELD_NAME_NOTE5');?></p>

                </div>

            </div>

            <div class="intro-item">

                <div class="intro-title"><?php echo L('FORM_NAME_NOTE');?> <i class="iconfont icon-xiangxiajiantou fr"></i></div>

                <div class="intro-detail hidden">

                    <p>1. <?php echo L('FORM_NAME_NOTE1');?></p>

                    <p>2. <?php echo L('FORM_NAME_NOTE2');?></p>

                    <p>3. <?php echo L('FORM_NAME_NOTE3');?></p>

                </div>

            </div>

            <div class="intro-item">

                <div class="intro-title"><?php echo L('FORM_DESCRIPTION_NOTE');?> <i class="iconfont icon-xiangxiajiantou fr"></i></div>

                <div class="intro-detail hidden">

                    <p><?php echo L('FORM_DESCRIPTION_NOTE1');?></p>

                </div>

            </div>

            <div class="intro-item">

                <div class="intro-title"><?php echo L('REQUIRED_ENABLE_NOTE');?> <i class="iconfont icon-xiangxiajiantou fr"></i></div>

                <div class="intro-detail hidden">

                    <p>1. <?php echo L('REQUIRED_ENABLE_NOTE1');?></p>

                    <p>2. <?php echo L('REQUIRED_ENABLE_NOTE2');?></p>

                </div>

            </div>

            <div class="intro-item">

                <div class="intro-title"><?php echo L('FORM_SORT_NOTE');?> <i class="iconfont icon-xiangxiajiantou fr"></i></div>

                <div class="intro-detail hidden">

                    <p>1. <?php echo L('FORM_SORT_NOTE1');?> </p>

                </div>

            </div>

        </div>

        

    </div>

    <script type="text/javascript" src="/Public/js/submitform.js"></script>
<script type="text/javascript">
	
	layui.use('form',function()
	{
		var form = layui.form;
		
		form.render('checkbox');
		
		form.render('radio');
		
		form.render('select');

	})
	
</script>

    <script type="text/javascript">

        $(function()
        {
            $(".form-tab").on('click',function()
            {
                if(!$(this).hasClass('active'))
                {
                    $(this).addClass('active');

                    $('.form-content').removeClass('hidden');

                    $(".intro-tab,.form-intro").addClass('hidden').removeClass('active');
                }
            });

            $(".intro-tab").on('click',function()
            {
                if(!$(this).hasClass('active'))
                {
                    $(this).addClass('active');

                    $('.form-intro').removeClass('hidden');

                    $('.form-tab,.form-content').addClass('hidden').removeClass('active');
                }
            });

            $(".intro-title").on('click',function()
            {
                $(this).next('.intro-detail').slideToggle().parent('.intro-item').toggleClass('active');

                if($(this).find('i').hasClass('icon-xiangxiajiantou'))
                {
                    $(this).find('i').removeClass('icon-xiangxiajiantou').addClass('icon-upward');
                }
                else
                {
                    $(this).find('i').removeClass('icon-upward').addClass('icon-xiangxiajiantou');
                }
            });
        })

    </script>



    </div>

    <script type="text/javascript">

        layer.ready(function()
        {
            layer.photos({
                photos: '.textareaImg',
                shift: 5,
                shade: [0.8, 'rgba(0,0,0,.8)']
            });

        })

    </script>

    <script>

        //客户端
        /*if ( navigator.userAgent.toLowerCase().indexOf('electron/') > -1)
        {
            top.setIframe(document);
        }*/
    </script>

    </body>

</html>